package com.snda.game.legend.service;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.snda.game.legend.dao.AdDao;
import com.snda.game.legend.entiy.Ad;

@Service
@Transactional
public class AdService implements BaseService<Ad> {
	@Resource
	private AdDao adDao;

	@Override
	public Ad find(int id) {
		return adDao.query(Ad.class, id);
	}

	@Override
	public Ad modify(Ad t) {
		return adDao.update(t);
	}

	@Override
	public void delete(Ad t) {
		adDao.delete(t);
	}

	@Override
	public Ad add(Ad t) {
		return adDao.insert(t);
	}

	@Override
	public List<Ad> find(String queryString) {
		return adDao.query(queryString);
	}
	
	public Map<Integer,List<Ad>>getAllEnableAds(){
		return adDao.getAllEnableAds();
		
	}

    public Map<Integer, List<Ad>> getAllAds() {
        return adDao.getAllAds();

    }

    public void expired() {
        adDao.expired();

    }

}
